# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=SDL_ttf
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.11
pkgrel=5
pkgdesc="A library that allows you to use TrueType fonts in your SDL applications (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://libsdl.org/projects/SDL_ttf/"
license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-SDL" "${MINGW_PACKAGE_PREFIX}-freetype")
options=('staticlibs' 'strip')
source=(https://libsdl.org/projects/SDL_ttf/release/${_realname}-${pkgver}.tar.gz)
sha256sums=('724cd895ecf4da319a3ef164892b72078bd92632a5d812111261cde248ebcdb7')

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
